#ifndef ALARMDIALOGV1_H
#define ALARMDIALOGV1_H

#include <QtGui>
#include <QtSql>


class MemoDetailInfoWidget;
namespace Ui {
    class AlarmDialogV1;
}

class AlarmDialogV1 : public QDialog {
    Q_OBJECT

    struct AlarmStruct{
        QString strID;
        QDateTime dtAlarmDate;
    };

public:
    AlarmDialogV1(QSqlDatabase _db,
                  QWidget *parent = 0);
    ~AlarmDialogV1();

protected:
    void changeEvent(QEvent *e);

private:
    Ui::AlarmDialogV1 *ui;

//-----------------------------------------------------
public slots:
    void updateAlarms();//query db again
    void updateComboxMemoLabel();

private:
    void initUIs();

private:
    QSqlDatabase m_SqlDB;

    QSqlTableModel* m_pAlarmRecoedModel;
    QSqlQueryModel* m_pAlarmQueryModel;

    QTimer* m_pTimer;

    QList<AlarmStruct> m_AlarmList;
    int m_AlarmIndex;

    MemoDetailInfoWidget* m_pMemoDetailInfoWidget;

protected:
    virtual void closeEvent (QCloseEvent* _e);
    virtual void keyPressEvent (QKeyEvent* _e);
private slots:
    void checkAlarm();

    void doComboBoxUnhandleAlarmsActived(int);
    void doComboBoxAllAlarmsActived(int);

    void doBtnDeleteAlarm();
    void doBtnDeleteMemo();
    void doBtnModifyMemo();


signals:
    void WeCannotSeeIt(bool);
    void ThereAreNewAlarms(int);
};

#endif // ALARMDIALOGV1_H
